import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/layout'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/headlines',
    children: [
      {
        // 头条
        path: '/headlines',
        component: () => import('@/views/Headlines/index.vue')
      },
      {
        // 社会
        path: '/society',
        component: () => import('@/views/Society/index.vue')
      },
      {
        // 国内
        path: '/domestic',
        component: () => import('@/views/Domestic/index.vue')
      },
      {
        // 国际
        path: '/international',
        component: () => import('@/views/International/index.vue')
      },
      {
        // 娱乐
        path: '/entertainment',
        component: () => import('@/views/Entertainment/index.vue')
      },
      {
        // 体育
        path: '/sports',
        component: () => import('@/views/Sports/index.vue')
      },
      {
        // 军事
        path: '/military',
        component: () => import('@/views/Military/index.vue')
      },
      {
        // 科技
        path: '/science',
        component: () => import('@/views/Science/index.vue')
      },
      {
        // 财经
        path: '/finance',
        component: () => import('@/views/Finance/index.vue')
      },
      {
        // 时尚
        path: '/fashion',
        component: () => import('@/views/Fashion/index.vue')
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
